package com.rainbow.controller

import com.rainbow.service.WeatherDataService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("/weather")
class WeatherController {

    @Autowired
    private lateinit var service: WeatherDataService

    @GetMapping("/cityId/{cityId}")
    fun getReportByCityId(@PathVariable cityId: String) = service.getDataByCityId(cityId)

    @GetMapping("/cityName/{cityName}")
    fun getReportByCityName(@PathVariable cityName: String) = service.getDataByCityName(cityName)
}